import { viteMockServe } from 'vite-plugin-mock'

export default function createMockServe(isBuild) {
  return viteMockServe({
    ignore: /^\_/,
    mockPath: 'mock',
    localEnabled: false,
    prodEnabled: isBuild,
    injectCode: `
              import { setupProdMockServer } from '../mock/_createProductionServer'

              setupProdMockServer()
              `
  })
}
